| 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 00572 00573 00574 00575 00576 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 00588 00589 00590 00591 00592 00593 00594 00595 00596 00597 00598 00599 00600 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 00613 00614 00615 00616 00617 00618 00619 00620 00621 00622 00623 00624 00625 00626 00627 00628 00629 00630 00631 00632 00633 00634 00635 00636 00637 00638 00639 00640 00641 00642 00643 00644 00645 00646 00647 00648 00649 00650 00651 00652 00653 00654 00655 00656 00657 00658 00659 00660 00661 00662 00663 00664 00665 00666 00667 00668 00669 00670 00671 00672 00673 00674 00675 00676 00677 00678 00679 00680 00681 00682 00683 00684 00685 00686 00687 00688 00689 00690 00691 00692 00693 00694 00695 00696 00697 00698 00699 00700 00701 00702 00703 00704 00705 00706 00707 00708 00709 00710 00711 00712 00713 00714 00715 00716 00717 00718 00719 00720 00721 00722 00723 00724 00725 00726 00727 00728 00729 00730 00731 00732 00733 00734 00735 00736 00737 00738 00739 00740 00741 00742 00743 00744 00745 | //============================================================================= // Spatial Fear // Class: SFTournamentWeapon // Descripton: Subclasses of Tournament weapon // modified to allow for behaviour adjustment required by SFPlayer class. // // Author: Markus Nuebel //============================================================================= class SFWeapon extends TournamentWeapon abstract; // Some fixes and additions to UT weapons var (Weapon) int MaxTargetRange; // Private: Range of fired projectiles and intant shots in UUs. var (Weapon) int MaxTargetRangeAlt; // Private: Range of fired projectiles and instant shots in UUs. (ALT fire mode) var (SpatialFear) travel int CreateTag; // Reference to players goaltable. If the tag is not -1 then the corrosponding goal is checked. If the goal was not reached already the pickup is destroyed during level entering. Default: -1 var (SpatialFear) float fNormalRate; // Amount of time, it takes to fire one shell with an PlayAnim rate of 1.0. Default: 0.33 (derived from Enforcer) var (SpatialFear) float fDesiredRate; // Amount of time, it takes to fire one shell in seconds. Default: 0.33 var (SpatialFear) float fAltDesiredRate; // Amount of time, it takes to fire one shell in seconds. Default: 0.33 (AltMode) var (SpatialFear) float fDamage; // Amout of damage this weapon does. Default: 20 var (SpatialFear) float fAltDamage; // Amout of damage this weapon does in alt mode. Default: 20 var (SpatialFear) int AmmoPerShot; // Amount of ammo, used per shot. Default: 1 var (SpatialFear) int AltAmmoPerShot; // Amount of ammo, used per shot in alt mode. Default: 1 var (SpatialFear) Texture Icon ; // Weapon icon displayed when the HUD upgrade module is equipped. var (SpatialFear) travel bool bInstantHit; // If true, instant hit rather than projectile firing weapon var (SpatialFear) float fMomentum; // Movment used for hit var (SpatialFear) float fAltMomentum; // Movment used for alt hit var (SpatialFear) bool bCanUpgradeLaserSight; // Determines, if this weapon can be upgraded with a Laser Sight, Default: false var (SpatialFear) bool bCanUpgradeEnergyBooster; // Determines, if this weapon can be upgraded with an Energy Booster, Default: false var (SpatialFear) string LaserSightUpgradeMessage; // Message displayed, when weapon is upgraded with the Laser Sight. var (SpatialFear) string EnergyBoosterUpgradeMessage; // Message displayed, when weapon is upgraded with the EnergyBooster. var (SpatialFear) Sound UpgradeWeaponSound; // Sound played when the weapon is upgraded. var (SpatialFear) bool bShake; // Activates shaking when fireing. Default: false var (SpatialFear) bool bFlash; // Activates flashing, when fireing. Default: false var (SpatialFear) float ShakeMagAlt; // ShakeMag in secondary (alt) mode var (SpatialFear) float ShakeTimeAlt; // ShakeTimeAlt in secondary (alt) mode var (SpatialFear) float ShakeVertAlt; // ShakeVertAlt in secondary (alt) mode var (SpatialFear) float InstantFlashAlt; // Scale for an instant flash (alt) mode var (SpatialFear) vector InstantFogAlt; // Vector for an instant flash (alt) mode var (SpatialFear) bool bTrailEffect; // Spawn a trail effect for bInstantHit weapons. Default: false var (SpatialFear) float m_fTrailEffectIntervallSize; // Size of intervall between single trail effects. Default: 125 var (SpatialFear) bool bAlienWeapon; // This flag is set to true for alien weapons, that cannot be used by a player var class<Actor> m_clsHitWallEffect; // Effect for wall hits var class<Actor> m_clsSmokeEffect; // Effect for body hits var class<Effects> m_clsTrailEffect; // Effect for trail of bInstantHit weapon var class<Actor> m_clsHitPawnEffect; // Effect for hitting a pawn var float m_fCurrentRate; // Private: Current PlayAnim rate, calculated from normal and desired. var float m_fAltCurrentRate; // Private: Current PlayAnim rate, calculated from normal and desired. (AltMode) var bool m_bSemiAuto; // Private: Is this a semi-auto or an automatic weapon. Default: false var bool m_bSemiAutoAlt; // Private: Semi-auto setting for ALT fire mode. Default: false var bool m_bAltMode; // Private: Current fire mode; var float AccuracyPenalty; // Private: Modified by SFPlayer class to adjust weapon accuracy. var float m_fTangentCalc; // Maximum y-axis penalty ranged, calculated based on the tangent of 5 degree for max distance of this weapon. Default: 1000 var float m_fTangentCalcAlt; // Maximum y-axis penalty ranged, calculated based on the tangent of 5 degree for max distance of this weapon (Alt mode). Default: 1000 var bool m_bHasLaserSight; // Private: Marks, if the weapon has already installed the laser sight upgrade. var bool m_bHasEnergyBooster; // Private: Marks, if the weapon has already installed the energy booster upgrade. var int nProjRange; // Private: Read only variable used for stats. var float fProjLifeSpan; // Private: Read only variable used for stats. Replication { Reliable if ( bNetOwner && (Role == ROLE_Authority) ) AccuracyPenalty; } // Events // // Called on entring play event PostBeginPlay() { // Call to base class Super.PostBeginPlay(); // Calculate actual PlayAnim rate m_fCurrentRate = fNormalRate/fDesiredRate; m_fAltCurrentRate = fNormalRate/fAltDesiredRate; // Calculate the accuracy penalty m_fTangentCalc = MaxTargetRange/19.0811366; // tan(87) in degree m_fTangentCalcAlt = MaxTargetRangeAlt/19.0811366; // tan(87) in degree } // Overwritten, to disable the automatic remove from the gameS function BecomePickup() { // Call to base class Super.BecomePickup(); bHeldItem=false; } // Upgrades the weapon with the laser sight function upgradeLaserSight() { if(bCanUpgradeLaserSight) { // Do the upgrade m_bHasLaserSight = true; // Reset the flag bCanUpgradeLaserSight=false; Pawn(Owner).ClientMessage(LaserSightUpgradeMessage); PlaySound(UpgradeWeaponSound, SLOT_None, Pawn(Owner).SoundDampening*3.0); } } // Upgrades the weapon with the energy booster function upgradeEnergyBooster(float fAmount) { if(bCanUpgradeEnergyBooster) { // Do the upgrade (15%) m_bHasEnergyBooster = true; fDamage *= 1 + fAmount; // Reset the flag bCanUpgradeEnergyBooster=false; Pawn(Owner).ClientMessage(EnergyBoosterUpgradeMessage); PlaySound(UpgradeWeaponSound, SLOT_None, Pawn(Owner).SoundDampening*3.0); } } // Spawns a configured smoke effect function spawnSmokeEffect(vector HitLocation, vector HitNormal) { if(None != m_clsSmokeEffect) spawn(m_clsSmokeEffect,,,HitLocation+HitNormal*9); } // Spawns a configured wallhit effect function spawnWallHitEffect(vector HitLocation, vector HitNormal) { if(None != m_clsHitWallEffect) Spawn(m_clsHitWallEffect,,, HitLocation+HitNormal, Rotator(HitNormal)); } // Spawns a configured effect when a pawn or carcass is hit function spawnPawnHitEffect(vector HitLocation, vector HitNormal) { if(None != m_clsHitPawnEffect) Spawn(m_clsHitPawnEffect,,, HitLocation+HitNormal, Rotator(HitNormal)); } // Simplified ProcessTraceHit, that handles a normal trace hit. // Does not spawn a shellcase !! function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z) { local float fCurrentMomentum; if(!IsInState('AltFiring')) fCurrentMomentum = fMomentum; else fCurrentMomentum = fAltMomentum; // Check for level hit if (Other == Level) { spawnWallHitEffect(HitLocation, HitNormal); } else if ( (Other!=self) && (Other != None) ) { // Hit something if ( !Other.bIsPawn && !Other.IsA('Carcass') ) { spawnSmokeEffect(HitLocation, HitNormal); Other.TakeDamage(fDamage, Pawn(Owner), HitLocation, fCurrentMomentum*X, MyDamageType); } else { spawnPawnHitEffect(HitLocation, HitNormal); Other.TakeDamage(fDamage, Pawn(Owner), HitLocation, fCurrentMomentum*X, MyDamageType); } } } // Does a shake for the primary weapon mode function ShakePrimary() { PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert); } // Does a flash for primary mode function FlashPrimary() { PlayerPawn(Owner).ClientInstantFlash(InstFlash, InstFog); } // Does a flash for secondary (alt) mode function FlashSecondary() { PlayerPawn(Owner).ClientInstantFlash( InstantFlashAlt, InstantFogAlt); } // Does a shake for the secondary weapon mode function ShakeSecondary() { PlayerPawn(Owner).ShakeView(ShakeTimeAlt, ShakeMagAlt, ShakeVertAlt); } // Can be overwritten in subclassed, that can be used as tools function PlayUseKeyHit() { } // Overwritten here to add SF features like range. function TraceFire( float Accuracy ) { local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z; local actor Other; local Pawn PawnOwner; local float fAimRange; local float fMaxRange; // log("Trace Fire Accuracy: " $ Accuracy $ " AccuracyPenalty "$ AccuracyPenalty); // Update accuracy /* if(!m_bHasLaserSight) Accuracy += AccuracyPenalty; else Accuracy = 0.01f; */ if(!IsInState('AltFiring')) { fMaxRange = MaxTargetRange; fAimRange = AccuracyPenalty*m_fTangentCalc; } else { fMaxRange = MaxTargetRangeAlt; fAimRange = AccuracyPenalty*m_fTangentCalcAlt; } // Correct for laser sight if(m_bHasLaserSight) fAimRange = 0; // log("AccuracyPenalty: " $ AccuracyPenalty $ " fAimRange: " $ fAimRange $ " m_fTangentCalc: " $ m_fTangentCalc); PawnOwner = Pawn(Owner); if(!PawnOwner.bIsPlayer) fAimRange /= 2.0f; Owner.MakeNoise(PawnOwner.SoundDampening); GetAxes(PawnOwner.ViewRotation,X,Y,Z); StartTrace = Owner.Location + CalcDrawOffset();// + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2*AimError, False, False); EndTrace = StartTrace + (FRand() - 0.5 )* Y * fAimRange + (FRand() - 0.5 ) * Z * fAimRange; X = vector(AdjustedAim); // Take the range into account EndTrace += (fMaxRange * X); Other = PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace); // Handle the trail effect here, since it depends on a valid Hitlocation if(None != Other) SpawnTrailEffect(m_clsTrailEffect, HitLocation, Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z, m_fTrailEffectIntervallSize, 9999.0f); else SpawnTrailEffect(m_clsTrailEffect, EndTrace, Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z, m_fTrailEffectIntervallSize, 9999.0f); // Call the hit routine ProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z); } // Calculates the projectile direction based on the current position and // the current accuracy penalty function vector calcProjectileDirection(Pawn Owner, vector vecStart, vector vecOwnerLocation, float fAccuracyError) { local float fAimError; local float fAimRange; local float fMaxRange; local Vector vecEnd, X,Y,Z; //147 = 1deg //870 = 5deg /* // Convert from fAccuracyError (given in degrees) to AimError // Aimerror of 1.0 equals 5 degrees, calculated by the tan on a triangle // of 10000 by 1000 if(0.0f == fAccuracyError) fAimError = 0.0f; else fAimError = fAccuracyError/5.0f; */ if(!IsInState('AltFiring')) { fMaxRange = MaxTargetRange; fAimRange = AccuracyPenalty*m_fTangentCalc; } else { fMaxRange = MaxTargetRangeAlt; fAimRange = AccuracyPenalty*m_fTangentCalcAlt; } // Correct for laser sight if(m_bHasLaserSight) fAimRange = 0; // Retrieve the current orientation GetAxes(Owner.ViewRotation,X,Y,Z); if(!Owner.bIsPlayer) fAimRange /= 2.0f; // Calculate the aiming direction with error //vecEnd = vecStart + fAimError * (FRand() - 0.5 )* Y * 1000 + fAimError* (FRand() - 0.5 ) * Z * 1000; /* // Using the corrected position vecEnd = vecOwnerLocation + (FRand() - 0.5 )* Y * fAimRange+ (FRand() - 0.5 ) * Z * fAimRange; // Add distance vecEnd += (10000 * vector(Owner.ViewRotation)) + 2*(vecOwnerLocation-vecStart); */ vecEnd = vecStart + (FRand() - 0.5 )* Y * fAimRange + (FRand() - 0.5 ) * Z * fAimRange; // Take the range into account vecEnd += (fMaxRange * X); // Distance is just the difference return(Normal(vecEnd-vecStart)); } // Fires a projectile weapon. Standard implementation, that just releases // an projectile. Special cases have to be handled in derived classes. function Projectile ProjectileFire(class<projectile> ProjClass, float fProjSpeed, bool bWarn) { local SFProjectile oProj; local Vector vecStart,X,Y,Z; local Vector vecDirection; local Vector test; // Make a noise, because we are fireing a weapon Owner.MakeNoise(Pawn(Owner).SoundDampening); // Extract the axis from the rotation GetAxes(Pawn(Owner).ViewRotation,X,Y,Z); // Calculate the start point vecStart = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; // Calculate the direction of the projectile if(!m_bHasLaserSight) vecDirection = calcProjectileDirection(Pawn(Owner), vecStart, Owner.Location, AccuracyPenalty); else vecDirection = calcProjectileDirection(Pawn(Owner), vecStart, Owner.Location, 0.01f); // Release the projectile oProj = SFProjectile(Spawn(ProjClass,,, vecStart, rotator(vecDirection))); // Set some projectile values if(!IsInState('AltFiring')) { oProj.setRange(MaxTargetRange); oProj.damage = fDamage; } else { oProj.setRange(MaxTargetRangeAlt); oProj.damage = fAltDamage; } nProjRange = oProj.Range; fProjLifeSpan = oProj.LifeSpan; return oProj; } function int getAmmoPerShot() { // First check, which mode we are in if(!IsInState('AltFiring')) return AmmoPerShot; else return AltAmmoPerShot; } // Overwritten to cope with nAmmoPerShot function float SwitchPriority() { local float temp; local int bTemp; local int nAmmoPerShot; nAmmoPerShot = getAmmoPerShot(); if ( !Owner.IsA('PlayerPawn') ) return RateSelf(bTemp); else if ( (AmmoType != None) && (AmmoType.AmmoAmount<=nAmmoPerShot) ) { if ( Pawn(Owner).Weapon == self ) return -0.5; else return -1; } else { return AutoSwitchPriority; } } // Spawns a trail effect function Effects SpawnTrailEffect(class<Effects> TrailEffect, vector HitLocation, vector SmokeLocation, float fIntervalSize, int nMaxIntervals) { local Effects TEffect; local Vector DVector; local int NumPoints; local rotator SmokeRotation; // Some inits DVector = HitLocation - SmokeLocation; NumPoints = VSize(DVector)/fIntervalSize; // Some checks if ( NumPoints < 1 ) return None; if( NumPoints > nMaxIntervals) NumPoints = nMaxIntervals; // Spawn the stuff SmokeRotation = rotator(DVector); SmokeRotation.roll = Rand(65535); TEffect = Spawn(TrailEffect,,,SmokeLocation,SmokeRotation); if(TEffect.IsA('ShockBeam')) { ShockBeam(TEffect).MoveAmount = DVector/NumPoints; ShockBeam(TEffect).NumPuffs = NumPoints - 1; } else if(TEffect.IsA('RingExplosion4')) { RingExplosion4(TEffect).MoveAmount = DVector/NumPoints; RingExplosion4(TEffect).NumPuffs = NumPoints - 1; } else if(TEffect.IsA('SFEffects')) { SFEffects(TEffect).MoveAmount = DVector/NumPoints; SFEffects(TEffect).NumPuffs = NumPoints - 1; } return TEffect; } ////////////////////////////////////////////// // States ////////////////////////////////////////////// auto state Pickup { // Overwritten Touch function, to get rid of the pickup messages function Touch( actor Other ) { // If touched by a player pawn, let him pick this up. if( ValidTouch(Other) ) { if (Level.Game.LocalLog != None) Level.Game.LocalLog.LogPickup(Self, Pawn(Other)); if (Level.Game.WorldLog != None) Level.Game.WorldLog.LogPickup(Self, Pawn(Other)); SpawnCopy(Pawn(Other)); PlaySound (PickupSound); if ( Level.Game.Difficulty > 1 ) Other.MakeNoise(0.1 * Level.Game.Difficulty); if ( Pawn(Other).MoveTarget == self ) Pawn(Other).MoveTimer = -1.0; } else if ( bTossedOut && (Other.Class == Class) && Inventory(Other).bTossedOut ) Destroy(); } singular function ZoneChange( ZoneInfo NewZone ) { // Do entry actor and sound display only for non Radiation zones if(!NewZone.IsA('SFRadiationZone')) Super.ZoneChange(NewZone); } } function AltFire( float Value ) { // Ammocheck if ( (AmmoType == None) && (AmmoName != None) ) GiveAmmo(Pawn(Owner)); if (AmmoType.UseAmmo(AltAmmoPerShot)) { GotoState('AltFiring'); if ( PlayerPawn(Owner) != None ) { if(bShake) ShakeSecondary(); if(bFlash) FlashSecondary(); } bPointing=True; PlayAltFiring(); if ( !bRapidFire && (FiringSpeed > 0) ) Pawn(Owner).PlayRecoil(FiringSpeed); if ( bAltInstantHit ) TraceFire(Value); else ProjectileFire(AltProjectileClass, AltProjectileSpeed, bAltWarnTarget); if ( Owner.bHidden ) CheckVisibility(); } else GotoState('Idle'); } function Fire( float Value ) { // Ammocheck if ( (AmmoType == None) && (AmmoName != None) ) GiveAmmo(Pawn(Owner)); if ( AmmoType.UseAmmo(AmmoPerShot) ) { GotoState('NormalFire'); if ( PlayerPawn(Owner) != None ) { if(bShake) ShakePrimary(); if(bFlash) FlashPrimary(); } bPointing=True; bCanClientFire = true; ClientFire(Value); if ( bRapidFire || (FiringSpeed > 0) ) { Pawn(Owner).PlayRecoil(FiringSpeed); } if ( bInstantHit ) { TraceFire(Value); } else { ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget); } } } // Overwrite of Weapon.Finish // Finish a firing sequence function Finish() { local Pawn PawnOwner; local bool bForce, bForceAlt; local int nAmmoPerShot; local bool bAltMode; bAltMode = IsInState('AltFiring'); // Check for semi-auto behaviour and reset the bFire indicator if( (((m_bSemiAuto) && !bAltMode) || ((m_bSemiAutoAlt) && bAltMode) ) && (Pawn(Owner).bFire != 0)) { Pawn(Owner).bFire = 0; } bForce = bForceFire; bForceAlt = bForceAltFire; bForceFire = false; bForceAltFire = false; if ( bChangeWeapon ) { GotoState('DownWeapon'); return; } if(!bAltMode) nAmmoPerShot = AmmoPerShot; else nAmmoPerShot = AltAmmoPerShot; PawnOwner = Pawn(Owner); if ( PawnOwner == None ) return; if ( PlayerPawn(Owner) != None ) { if ( (AmmoType != None) && (AmmoType.AmmoAmount<nAmmoPerShot) ) { PawnOwner.StopFiring(); PawnOwner.SwitchToBestWeapon(); if ( bChangeWeapon ) GotoState('DownWeapon'); else GotoState('Idle'); } else if ( (PawnOwner.bFire != 0) && (FRand() < RefireRate) ) Global.Fire(0); else if ( (PawnOwner.bAltFire != 0) && (FRand() < AltRefireRate) ) Global.AltFire(0); else { PawnOwner.StopFiring(); GotoState('Idle'); } return; } if ( ((AmmoType != None) && (AmmoType.AmmoAmount<=0)) || (PawnOwner.Weapon != self) ) GotoState('Idle'); else if ( (PawnOwner.bFire!=0) || bForce ) Global.Fire(0); else if ( (PawnOwner.bAltFire!=0) || bForceAlt ) Global.AltFire(0); else GotoState('Idle'); } // // Set up respawn waiting if desired. // function SetRespawn() { //log("%%% setrespawn"); if( Level.Game.ShouldRespawn(self) ) { //log("%%% setrespawn: sleeping"); GotoState('Sleeping'); } else { //log("%%% setrespawn: destroy"); Destroy(); } } // Either give this inventory to player Other, or spawn a copy // and give it to the player Other, setting up original to be respawned. // Also add Ammo to Other's inventory if it doesn't already exist // function inventory SpawnCopy( pawn Other ) { local inventory Copy; local Weapon newWeapon; //log("%%%Weapon: spawncopy "); if( Level.Game.ShouldRespawn(self) ) { //log("%%%Weapon: spawncopy ShouldRespawn: true"); Copy = spawn(Class,Other,,,rot(0,0,0)); Copy.Tag = Tag; Copy.Event = Event; if ( !bWeaponStay ) { //log("%%%Weapon: spawncopy bWeaponStay: true"); GotoState('Sleeping'); } } else Copy = self; Copy.RespawnTime = 0.0; Copy.bHeldItem = true; Copy.bTossedOut = false; Copy.GiveTo( Other ); newWeapon = Weapon(Copy); newWeapon.Instigator = Other; newWeapon.GiveAmmo(Other); newWeapon.SetSwitchPriority(Other); if ( !Other.bNeverSwitchOnPickup ) newWeapon.WeaponSet(Other); newWeapon.AmbientGlow = 0; return newWeapon; } state Idle { function AnimEnd() { PlayIdleAnim(); } function bool PutDown() { GotoState('DownWeapon'); return True; } Begin: bPointing=False; if ( (AmmoType != None) && (AmmoType.AmmoAmount<=0) ) if(!Pawn(Owner).SwitchToBestWeapon()) //Goto Weapon that has Ammo { if(None == Weapon(Pawn(Owner).FindInventoryType(class'SFNullGun'))) { // Spawn the null gun Pawn(Owner).PendingWeapon = spawn(class'SFNullGun', Owner); } PutDown(); } if ( Pawn(Owner).bFire!=0 ) Fire(0.0); if ( Pawn(Owner).bAltFire!=0 ) AltFire(0.0); Disable('AnimEnd'); PlayIdleAnim(); } // Firing speed should match fDesiredRate, since it determines the recoil animation on the player defaultproperties { MaxTargetRange=1000 MaxTargetRangeAlt=1000 CreateTag=-1 fNormalRate=0.330000 fDesiredRate=0.330000 fAltDesiredRate=0.330000 fDamage=20.000000 fAltDamage=20.000000 AmmoPerShot=1 AltAmmoPerShot=1 LaserSightUpgradeMessage="Upgraded with Laser Sight" UpgradeWeaponSound=Sound'Botpack.Pickups.UTHealth' m_fTrailEffectIntervallSize=135.000000 m_fTangentCalc=1000.000000 m_fTangentCalcAlt=1000.000000 FiringSpeed=0.330000 MyDamageType=' aimerror=1050.000000 FireSound=Sound'Botpack.enforcer.E_Shot' AutoSwitchPriority=0 InventoryGroup=0 bRotatingPickup=False PickupMessageClass=None CollisionRadius=24.000000 CollisionHeight=10.000000 } |